﻿using Microsoft.EntityFrameworkCore;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

using ZFB.Models;
using ZFB.Models.EntityConfig;

namespace ZFB.Repository.Region
{
    public class RegionRepository : BaseRepository<T_Regions>, IRegionRepository
    {
        private readonly MyDbContext db;
        public RegionRepository(MyDbContext db) : base(db)
        {
            this.db = db;
        }
        public async override Task<List<T_Regions>> GetListAsync(Expression<Func<T_Regions, bool>> whereExpression)
        {
            return await db.T_Regions
                .Where(e => !e.IsDeleted)
                .Where(whereExpression)
                .Include(e=>e.T_Cities)
                .ToListAsync();
        }
    }
}
